import api from './index.js'

// 认证相关API - 负责人：陆楚盈
export const authAPI = {
  // 用户登录
  login({ username, password, rememberMe }) {
    return api.post('/auth/login', { username, password, rememberMe })
  },

  // 用户注册
  register({ username, password, confirmPassword, avatar }) {
    return api.post('/auth/register', { username, password, confirmPassword, avatar })
  },

  // 忘记密码（重置密码）
  forgotPassword({ username, newPassword }) {
    return api.post('/auth/forgot-password', { username, newPassword })
  },

  // 重置密码
  resetPassword(token, newPassword) {
    return api.post('/auth/reset-password', { token, newPassword })
  },

  // 刷新token
  refreshToken() {
    return api.post('/auth/refresh-token')
  },

  // 登出
  logout() {
    return api.post('/auth/logout')
  },

  // 验证token
  verifyToken() {
    return api.get('/auth/verify')
  }
}
